
<?php

if ($this->session->flashdata('message'))
    echo "<div class='message'>" . $this->session->flashdata('message') . "</div>";
$btn_search = array(
    'class' => 'btn btn-sm btn-primary btn-block',
    'value' => 'Buscar'
);

echo validation_errors('<div class="error">', '</div>');
echo '</br>';

echo"<table>";
echo"<tr>";
echo"<td>";
echo '</div>';
echo"</td>";
echo"</tr>";
echo"</table>";


echo'<div class="panel panel-default">';
echo '<div class="panel-heading">Citas</div>';
echo '<div class="panel-body">';

if ($citas == null) {
    echo 'No Hay Citas';
} else {
    echo '<table cellpadding="0" cellspacing="0" border="1" class="table table-striped table-bordered table-condensed table-responsive" id="tblEspecialidades" width="100%">';
    echo "<thead>\n<tr>\n";
    echo "<th>Fecha</th><th>Hora Inicio</th><th>Fecha Fin</th><th>Médico</th><th>Estado</th><th>Eliminar</th>\n";
    foreach ($citas as $fila) {
        $btn_editar = array(
            'class' => 'btn btn-sm btn-primary btn-block',
            'value' => 'Eliminar'
        );
        echo "<tr valign='top'>\n";
         echo "<td align='left'>" . $fila['fecha'] . "</td>";
        echo "<td align='left'>" . $fila['hora_inicio'] . "</td>";
        echo "<td align='left'>" . $fila['hora_fin'] . "</td>";
        echo "<td align='left'>" . $fila['nombres'] . " " . $fila['apellidos'] . "</td>";
        if ($fila['estado'] == "0") {
            echo "<td align='left'>En espera</td>";
        } else {
            echo "<td align='left'>Aprobado</td>";
        }
        echo'<td align="left">';
        if($fila['estado']==0){
        echo anchor("cita_medica_controller/eliminar_cita_paciente/" . $fila['id'], 'Eliminar', $btn_editar);
        echo "</tr>\n";
        }else{
            echo 'No puede eliminar';
        }
    }
    echo "</tbody></table>";
}
echo '</div></div>';
?>
